#!/usr/bin/env python
"""
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""

from lib.core.compat import xrange
from lib.core.enums import PRIORITY

__priority__ = PRIORITY.HIGHEST


def dependencies():
    # Placeholder for any dependencies
    pass


def tamper(payload, **kwargs):
    """
    % to ~

    Tested against:
    * Microsoft SQL Server 2005
    * MySQL 4, 5.0 and 5.5

    Notes:
    * % to ~

    >>> tamper('%20')
    '~20'
    """
    retVal = payload

    if payload:
        modified_payload = ""
        for char in payload:
            modified_payload += hex(ord(char))

        retVal = modified_payload.replace("0x", "~")

    return retVal
